{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人\n",
    "\n",
    "2.将六个班的考试成绩进行合并得到score\n",
    "\n",
    "3.生成性别数组sex，水平叠加数组sex和score得到data\n",
    "\n",
    "4.分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Score:\n",
    "    def __init__(self,num,class_id):\n",
    "        self.class_id = class_id\n",
    "        self.student_num = num # 班级人数\n",
    "        self.class_student_info = []\n",
    "        self.class_score_info =[]\n",
    "        self.sex = []\n",
    "        \n",
    "    def class_score(self):\n",
    "        \"\"\"生成一个对象来记录每个学生的成绩，\"\"\"\n",
    "        i = 1\n",
    "        while i <= self.student_num:\n",
    "            s = Student(class_id=self.class_id)\n",
    "            self.class_student_info.append(s)\n",
    "            i += 1\n",
    "            \n",
    "    def data(self):\n",
    "        for i in self.class_student_info:\n",
    "            score = [i.python,i.chinese,i.math]\n",
    "            sex = [i.sex]\n",
    "            self.class_score_info.append(score)\n",
    "            self.sex.append(sex)\n",
    "        self.class_score_info = np.array(self.class_score_info)\n",
    "        self.sex = np.array(self.sex)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Student:\n",
    "    count = 0\n",
    "    @classmethod\n",
    "    def generate_id(cls):\n",
    "        cls.count += 1\n",
    "        return cls.count\n",
    "    \n",
    "    def __init__(self,class_id):\n",
    "        self.student_id = str(class_id).zfill(2)+str(self.generate_id()).zfill(2)\n",
    "        self.sex = np.random.randint(0,2)\n",
    "        self.python = np.random.randint(0,100)\n",
    "        self.chinese = np.random.randint(0,100)\n",
    "        self.math = np.random.randint(0,100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 生成数据\n",
    "c1 = Score(num = 50,class_id= 1)\n",
    "c1.class_score()\n",
    "c1.data()\n",
    "c2 = Score(num = 50,class_id= 2)\n",
    "c2.class_score()\n",
    "c2.data()\n",
    "c3 = Score(num = 50,class_id= 3)\n",
    "c3.class_score()\n",
    "c3.data()\n",
    "c4 = Score(num = 50,class_id= 4)\n",
    "c4.class_score()\n",
    "c4.data()\n",
    "c5 = Score(num = 50,class_id= 5)\n",
    "c5.class_score()\n",
    "c5.data()\n",
    "c6 = Score(num = 50,class_id= 6)\n",
    "c6.class_score()\n",
    "c6.data()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 将六个班的考试成绩进行合并得到score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[47, 29, 39],\n",
       "       [74, 15, 88],\n",
       "       [27, 43, 42],\n",
       "       [42, 53,  8],\n",
       "       [89, 75, 62],\n",
       "       [23, 50, 69],\n",
       "       [25,  4, 46],\n",
       "       [66, 25, 82],\n",
       "       [12, 50, 29],\n",
       "       [31, 15, 50],\n",
       "       [ 1,  8, 29],\n",
       "       [59, 70, 58],\n",
       "       [33, 56,  1],\n",
       "       [25, 26, 95],\n",
       "       [84, 47,  7],\n",
       "       [74,  4, 31],\n",
       "       [95, 60, 43],\n",
       "       [75,  3, 93],\n",
       "       [27, 88, 83],\n",
       "       [70, 67, 63],\n",
       "       [53, 67, 26],\n",
       "       [51, 35, 45],\n",
       "       [ 7, 81,  3],\n",
       "       [59, 69,  4],\n",
       "       [18, 43, 12],\n",
       "       [78, 92, 12],\n",
       "       [50, 72, 88],\n",
       "       [64,  6, 10],\n",
       "       [62, 16, 39],\n",
       "       [32, 15, 56],\n",
       "       [41, 68,  4],\n",
       "       [94, 29, 19],\n",
       "       [11, 99, 54],\n",
       "       [ 3, 54, 67],\n",
       "       [83, 23, 89],\n",
       "       [99, 33,  3],\n",
       "       [79, 39, 45],\n",
       "       [54, 91, 73],\n",
       "       [22,  5, 59],\n",
       "       [ 6,  6, 43],\n",
       "       [ 7,  9, 91],\n",
       "       [92, 72, 60],\n",
       "       [79, 69, 53],\n",
       "       [ 0, 98, 95],\n",
       "       [85, 75, 53],\n",
       "       [84, 79, 71],\n",
       "       [24, 97, 83],\n",
       "       [31, 61,  4],\n",
       "       [38, 43, 28],\n",
       "       [51, 70, 91],\n",
       "       [88, 75, 20],\n",
       "       [24, 78, 53],\n",
       "       [23, 16, 23],\n",
       "       [27,  5, 48],\n",
       "       [26, 27, 74],\n",
       "       [52, 25, 36],\n",
       "       [79, 80, 31],\n",
       "       [28,  3, 26],\n",
       "       [80, 81, 34],\n",
       "       [13, 88, 43],\n",
       "       [62, 65, 41],\n",
       "       [97,  3, 39],\n",
       "       [10, 30, 33],\n",
       "       [39, 28, 95],\n",
       "       [80, 67, 46],\n",
       "       [99, 60, 72],\n",
       "       [91, 49, 91],\n",
       "       [26, 16, 56],\n",
       "       [60, 11, 67],\n",
       "       [ 2, 27, 84],\n",
       "       [89, 84, 70],\n",
       "       [51,  9, 93],\n",
       "       [36, 55, 48],\n",
       "       [33, 31, 33],\n",
       "       [60, 77, 23],\n",
       "       [36, 53, 48],\n",
       "       [51, 65, 90],\n",
       "       [86, 26, 92],\n",
       "       [21, 73, 74],\n",
       "       [ 4, 69, 90],\n",
       "       [53, 92, 18],\n",
       "       [94, 47, 46],\n",
       "       [73, 70, 32],\n",
       "       [80, 53, 58],\n",
       "       [67,  2, 96],\n",
       "       [ 9, 55, 89],\n",
       "       [46, 31, 87],\n",
       "       [ 2, 34, 89],\n",
       "       [69, 93, 93],\n",
       "       [94, 75, 78],\n",
       "       [50, 77, 64],\n",
       "       [82, 78, 10],\n",
       "       [63, 20, 40],\n",
       "       [98,  5, 81],\n",
       "       [ 3, 93, 92],\n",
       "       [36, 34, 84],\n",
       "       [18, 77, 19],\n",
       "       [52, 35, 68],\n",
       "       [53, 79, 59],\n",
       "       [37, 43, 11],\n",
       "       [18, 86, 61],\n",
       "       [74, 47, 99],\n",
       "       [23, 98, 92],\n",
       "       [87, 90, 72],\n",
       "       [94, 42,  6],\n",
       "       [88, 10,  5],\n",
       "       [61, 80, 69],\n",
       "       [67, 50, 32],\n",
       "       [36, 43, 27],\n",
       "       [63, 50, 38],\n",
       "       [ 8,  2, 13],\n",
       "       [77, 68,  0],\n",
       "       [42, 27, 82],\n",
       "       [ 0, 95,  6],\n",
       "       [37, 89, 43],\n",
       "       [80, 75, 49],\n",
       "       [36, 58, 94],\n",
       "       [74, 78,  9],\n",
       "       [46, 74, 17],\n",
       "       [43, 49, 27],\n",
       "       [47, 12,  2],\n",
       "       [54, 46,  9],\n",
       "       [97, 69, 14],\n",
       "       [64, 23, 51],\n",
       "       [77, 64, 86],\n",
       "       [ 7, 19, 68],\n",
       "       [87, 38, 25],\n",
       "       [71, 56, 27],\n",
       "       [ 5, 57, 18],\n",
       "       [18, 69, 66],\n",
       "       [44, 61, 43],\n",
       "       [99, 34, 57],\n",
       "       [60, 14, 69],\n",
       "       [82, 23, 80],\n",
       "       [18, 33, 45],\n",
       "       [79, 67, 65],\n",
       "       [47,  0, 62],\n",
       "       [43, 69, 82],\n",
       "       [90, 70, 39],\n",
       "       [70, 76, 99],\n",
       "       [39, 81, 85],\n",
       "       [72, 99, 79],\n",
       "       [ 4, 50, 20],\n",
       "       [74, 72, 40],\n",
       "       [66, 86, 57],\n",
       "       [67, 39, 19],\n",
       "       [38, 90, 39],\n",
       "       [ 3, 21, 81],\n",
       "       [26, 99, 62],\n",
       "       [76, 24,  7],\n",
       "       [27, 41,  7],\n",
       "       [ 8, 65, 33],\n",
       "       [61, 47, 44],\n",
       "       [34,  2, 18],\n",
       "       [14, 49, 32],\n",
       "       [28, 47, 51],\n",
       "       [63, 69, 46],\n",
       "       [17, 63, 87],\n",
       "       [10,  5, 46],\n",
       "       [79, 38, 73],\n",
       "       [19, 57, 85],\n",
       "       [42, 69,  1],\n",
       "       [25, 75, 64],\n",
       "       [38, 32, 95],\n",
       "       [66,  0, 67],\n",
       "       [ 4, 82,  1],\n",
       "       [62, 64, 69],\n",
       "       [68, 44, 38],\n",
       "       [56, 97, 14],\n",
       "       [36, 91, 32],\n",
       "       [27,  6, 56],\n",
       "       [ 7, 60, 10],\n",
       "       [59, 66, 46],\n",
       "       [84, 23, 67],\n",
       "       [95, 62, 56],\n",
       "       [44, 13, 37],\n",
       "       [24, 88, 10],\n",
       "       [80, 74, 14],\n",
       "       [ 3, 46, 97],\n",
       "       [30, 76, 32],\n",
       "       [58, 83, 53],\n",
       "       [45, 65, 26],\n",
       "       [68, 85, 53],\n",
       "       [23, 30, 66],\n",
       "       [11, 48, 42],\n",
       "       [19, 34, 37],\n",
       "       [76,  5, 90],\n",
       "       [92,  8, 58],\n",
       "       [36, 99, 75],\n",
       "       [75, 96, 76],\n",
       "       [94, 64, 25],\n",
       "       [28, 83, 30],\n",
       "       [25, 13, 25],\n",
       "       [43, 65, 86],\n",
       "       [16, 92, 57],\n",
       "       [40, 49, 58],\n",
       "       [80, 63, 71],\n",
       "       [53, 56, 69],\n",
       "       [ 1, 68, 71],\n",
       "       [69, 84, 23],\n",
       "       [71, 86, 24],\n",
       "       [39, 14, 33],\n",
       "       [99, 93,  4],\n",
       "       [76, 81, 39],\n",
       "       [70, 40,  5],\n",
       "       [63, 98, 58],\n",
       "       [ 1, 84, 79],\n",
       "       [81,  6, 72],\n",
       "       [10, 84, 75],\n",
       "       [86, 33, 66],\n",
       "       [91, 53, 27],\n",
       "       [24, 71, 17],\n",
       "       [80, 30, 71],\n",
       "       [99, 87, 40],\n",
       "       [64, 97, 92],\n",
       "       [ 3, 36, 28],\n",
       "       [93,  7, 65],\n",
       "       [71, 18, 61],\n",
       "       [ 6,  1, 64],\n",
       "       [23, 64, 44],\n",
       "       [30, 53, 94],\n",
       "       [81, 46, 92],\n",
       "       [24, 38, 51],\n",
       "       [66, 71,  6],\n",
       "       [30, 89, 71],\n",
       "       [74, 60, 33],\n",
       "       [38,  0, 98],\n",
       "       [ 5, 56, 79],\n",
       "       [53, 88, 30],\n",
       "       [28, 47, 45],\n",
       "       [89, 12, 13],\n",
       "       [36, 83, 52],\n",
       "       [76, 74, 73],\n",
       "       [ 5,  4, 81],\n",
       "       [ 7, 18, 33],\n",
       "       [35,  1, 60],\n",
       "       [51, 79, 99],\n",
       "       [46, 91, 39],\n",
       "       [14, 49, 74],\n",
       "       [29,  2, 28],\n",
       "       [11, 21, 18],\n",
       "       [ 7,  2, 25],\n",
       "       [89, 86, 48],\n",
       "       [52, 55, 68],\n",
       "       [78,  2, 51],\n",
       "       [74, 47, 52],\n",
       "       [94, 17,  5],\n",
       "       [72,  3,  8],\n",
       "       [46, 23, 82],\n",
       "       [72, 80, 62],\n",
       "       [60, 87, 62],\n",
       "       [70, 45,  1],\n",
       "       [15, 49, 42],\n",
       "       [22, 28,  0],\n",
       "       [67, 43, 83],\n",
       "       [37, 54, 19],\n",
       "       [68, 93, 81],\n",
       "       [55, 49, 55],\n",
       "       [ 9, 92, 84],\n",
       "       [30, 60, 13],\n",
       "       [72, 78, 86],\n",
       "       [37, 69, 96],\n",
       "       [ 3, 65, 51],\n",
       "       [57, 17, 82],\n",
       "       [62, 21, 17],\n",
       "       [51, 74, 82],\n",
       "       [25, 29, 49],\n",
       "       [21, 59, 63],\n",
       "       [84, 92, 64],\n",
       "       [53, 51, 19],\n",
       "       [68, 31, 65],\n",
       "       [33, 98, 97],\n",
       "       [58, 93, 29],\n",
       "       [96, 81, 45],\n",
       "       [62, 45, 94],\n",
       "       [46,  5, 85],\n",
       "       [78, 56, 44],\n",
       "       [87,  8, 20],\n",
       "       [22, 14, 60],\n",
       "       [40, 31, 26],\n",
       "       [93, 69, 41],\n",
       "       [69, 64, 42],\n",
       "       [99, 25,  0],\n",
       "       [11, 63, 64],\n",
       "       [26, 61, 26],\n",
       "       [31, 62, 33],\n",
       "       [89, 50, 42],\n",
       "       [42, 67, 66],\n",
       "       [61, 96,  0],\n",
       "       [79, 34, 94],\n",
       "       [ 5, 37, 62],\n",
       "       [92, 23,  0],\n",
       "       [57, 97, 51],\n",
       "       [52, 32, 21],\n",
       "       [36,  5, 79],\n",
       "       [50, 56, 24],\n",
       "       [23, 56, 11],\n",
       "       [69, 36,  5],\n",
       "       [22, 98, 98],\n",
       "       [13, 74, 29]])"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c1.class_score_info\n",
    "score = np.concatenate([c1.class_score_info,c2.class_score_info,c3.class_score_info,c4.class_score_info,c5.class_score_info,c6.class_score_info])\n",
    "score"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 生成性别数组sex，水平叠加数组sex和score得到data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1]])"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex = np.concatenate([c1.sex,c2.sex,c3.sex,c4.sex,c5.sex,c6.sex])\n",
    "sex"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0, 47, 29, 39],\n",
       "       [ 0, 74, 15, 88],\n",
       "       [ 0, 27, 43, 42],\n",
       "       ...,\n",
       "       [ 0, 69, 36,  5],\n",
       "       [ 1, 22, 98, 98],\n",
       "       [ 1, 13, 74, 29]])"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = np.concatenate([sex,score],axis = 1)\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [],
   "source": [
    "male = data[data[:,0] == 1] # 男\n",
    "female = data[data[:,0] == 0] # 女"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "255"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "250"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 最大值\n",
    "max_male = male[:,1:]\n",
    "max_male = max_male.sum(axis=1)\n",
    "max_female = female[:,1:]\n",
    "max_female = max_female.sum(axis=1)\n",
    "display(max_female.max(),max_male.max())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "34"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 最小值\n",
    "min_male = male[:,1:]\n",
    "min_male = min_male.sum(axis=1)\n",
    "min_female = female[:,1:]\n",
    "min_female = min_female.sum(axis=1)\n",
    "display(min_female.min(),min_male.min())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "147.54193548387096"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "155.12413793103448"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 平均分\n",
    "mean_male = male[:,1:]\n",
    "mean_male = mean_male.sum(axis=1)\n",
    "mean_female = female[:,1:]\n",
    "mean_female = mean_female.sum(axis=1)\n",
    "display(min_female.mean(),min_male.mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "151.0"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "163.0"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 中位数\n",
    "median_male = male[:,1:]\n",
    "median_male = median_male.sum(axis=1)\n",
    "median_female = female[:,1:]\n",
    "median_female = median_female.sum(axis=1)\n",
    "display(np.median(min_female),np.median(min_male))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "48.665048557384715"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "49.20273089682231"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 标准差\n",
    "std_male = male[:,1:]\n",
    "std_male = std_male.sum(axis=1)\n",
    "std_female = female[:,1:]\n",
    "std_female = std_female.sum(axis=1)\n",
    "display(min_female.std(),min_male.std())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
